package top.rainbowecho.notify.domain.model.email;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import top.rainbowecho.common.mq.mo.MailMeta;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import java.io.IOException;

/**
 * 邮件发送装饰器父类，每一个装饰器需继承该类
 *
 * @author rainbow
 * @since 2019/11/28 14:20
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public abstract class EmailDecorator extends Mail {
    private Mail mail;

    @Override
    public MimeMessage generateHtmlMail(MailMeta info) throws MessagingException, IOException {
        return this.mail.generateHtmlMail(info);
    }

    @Override
    public void send(MimeMessage mess) {
        this.mail.send(mess);
    }
}
